package view;



import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListSelectionModel;


import net.miginfocom.swing.MigLayout;


/**
 * This class manages the meeting navigation window
 * 
 * The meeting navigation view contains a list of all meetings and allows the user to add a new meeting.
 * @author buthainahaldosary
 * @since May 31, 2013
 * @version $Revision: 1.0 $
 */
public class MeetingNavigationView extends JPanel{

		
		/**
		 * Labels for my meetings and meeting requests
		 */
		private JLabel myMeetings, MeetingRequests;
		
	
		
		/**
		 * Displays of all meetings
		 */
		private JList meetingsList;
		
		/**
		 * Display all meeting requests
		 */
		private JList meetingRequestsList;
		/**
		 * Button to create a new meeting
		 */
		private JButton newMeeting;
		/**
		 * Model that stores a list of all meetings
		 */
		private DefaultListModel<String> meetings;
		
		/**
		 * Model that stores a list of all meeting requests
		 */
		private DefaultListModel<String> meetingRequests;
	
		/**
		 * Default constructor that initializes the components and adds them to the view.
		
		 * @param migLayout migLayout the layout type used
		 */
		public MeetingNavigationView(MigLayout migLayout) {
			super(migLayout);
			newMeeting = new JButton("New Meeting",IconsManager.getImageIcon("small/plus.png"));
			
		
			
			// Setup the meetings
			myMeetings=new JLabel("My Meetings");
			meetings = new DefaultListModel<String>();
			meetingsList = new JList(meetings);
			meetingsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			this.add(newMeeting, "wrap, width 150, height 50");
			this.add(myMeetings,"wrap");
			this.add(meetingsList,"grow,wrap");
			
		
			
			
			
			
			// Setup the meeting requests
			MeetingRequests=new JLabel("Meeting Requests");	
			meetingRequests = new DefaultListModel<String>();
			meetingRequestsList = new JList(meetingRequests);
			meetingRequestsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			this.add(MeetingRequests, "wrap");
			this.add(meetingRequestsList, "grow, wrap");
			
			
			
		}

		/**
		 * 
		
		 * @return the JList that contains all the meetings. */
		public JList getMeetingsList() {
			return meetingsList;
		}

		/**
		 * 
		 * @param meetingsList the JList to be set.
		 */
		public void setMeetingsList(JList meetingsList) {
			this.meetingsList = meetingsList;
		}

		/**
		 * 
		
		 * @return new meeting JButton */
		public JButton getNewMeeting() {
			return newMeeting;
		}
		/**
		 * 
		 * @param newMeeting the JButton to be set
		 */
		public void setNewMeeting(JButton newMeeting) {
			this.newMeeting = newMeeting;
		}
		/**
		 * 
		
		 * @return the ListModel meeting strings */
		public DefaultListModel<String> getMeetings() {
			return meetings;
		}
		/**
		 * 
		 * @param meetings the List model of meeting strings to be set
		 */
		public void setMeetings(DefaultListModel<String> meetings) {
			this.meetings = meetings;
		}
}
